﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Console_EchoClient
{
    class Program
    {
        static void Main(string[] args)
        {
            EchoClient ecClient = new EchoClient();
            ecClient.Init();
            ushort nRet = ecClient.Open();

            if (HalfNetworkNET.ERRORCODE.NONE != nRet)
            {
                Console.WriteLine("Fail Open!. ErrorCode({0})", nRet);
                return;
            }
            else
            {
                Console.WriteLine("Client Config Info");

                HalfNetworkNET.ClientConfig config = ecClient.GetConfig();
                Console.WriteLine("WorkerThreadCount : {0}", config.WorkerThreadCount);
                Console.WriteLine("IntervalSendTerm : {0}", config.IntervalSendTerm);
                Console.WriteLine("IsDirectSend : {0}", config.IsDirectSend);
                Console.WriteLine("ReceiveBufferLength : {0}", config.ReceiveBufferLength);
                Console.WriteLine("PrepareMemoryBlockSize : {0}", config.PrepareMemoryBlockSize);
                Console.WriteLine("PrepareMemoryBlockCount : {0}", config.PrepareMemoryBlockCount);
            }

            bool bRet = ecClient.Connect("127.0.0.1", 25001, 1);
            if (false == bRet)
            {
                Console.WriteLine("Connect fail !!!");
            }
            else
            {
                Console.WriteLine("Connect Success !!!");
            }
            
            while (true)
            {
                ecClient.Run();
            }

            ecClient.End();

        }
    }
}
